import 'package:high_help_apps/common/entities/user/user_profile_response_entity.dart';

userProfileResponseEntityFromJson(UserProfileResponseEntity data, Map<String, dynamic> json) {
	if (json['success'] != null) {
		data.success = json['success'];
	}
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['message'] != null) {
		data.message = json['message'].toString();
	}
	if (json['detail'] != null) {
		data.detail = UserProfileResponseDetail().fromJson(json['detail']);
	}
	return data;
}

Map<String, dynamic> userProfileResponseEntityToJson(UserProfileResponseEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['success'] = entity.success;
	data['code'] = entity.code;
	data['message'] = entity.message;
	data['detail'] = entity.detail?.toJson();
	return data;
}

userProfileResponseDetailFromJson(UserProfileResponseDetail data, Map<String, dynamic> json) {
	if (json['uid'] != null) {
		data.uid = json['uid'] is String
				? int.tryParse(json['uid'])
				: json['uid'].toInt();
	}
	if (json['real_name'] != null) {
		data.realName = json['real_name'].toString();
	}
	if (json['role_int'] != null) {
		data.roleInt = json['role_int'];
	}
	if (json['email'] != null) {
		data.email = json['email'].toString();
	}
	if (json['avatar'] != null) {
		data.avatar = json['avatar'].toString();
	}
	if (json['phone'] != null) {
		data.phone = json['phone'];
	}
	if (json['birthday'] != null) {
		data.birthday = json['birthday'].toString();
	}
	if (json['sex'] != null) {
		data.sex = json['sex'].toString();
	}
	if (json['location'] != null) {
		data.location = json['location'].toString();
	}
	if (json['nick_name'] != null) {
		data.nickName = json['nick_name'].toString();
	}
	if (json['fans'] != null) {
		data.fans = json['fans'] is String
				? int.tryParse(json['fans'])
				: json['fans'].toInt();
	}
	if (json['level'] != null) {
		data.level = json['level'] is String
				? int.tryParse(json['level'])
				: json['level'].toInt();
	}
	if (json['follows'] != null) {
		data.follows = json['follows'] is String
				? int.tryParse(json['follows'])
				: json['follows'].toInt();
	}
	if (json['sign'] != null) {
		data.sign = json['sign'];
	}
	if (json['school'] != null) {
		data.school = json['school'] is String
				? int.tryParse(json['school'])
				: json['school'].toInt();
	}
	if (json['major'] != null) {
		data.major = json['major'] is String
				? int.tryParse(json['major'])
				: json['major'].toInt();
	}
	if (json['sign_time'] != null) {
		data.signTime = json['sign_time'] is String
				? int.tryParse(json['sign_time'])
				: json['sign_time'].toInt();
	}
	if (json['class_name'] != null) {
		data.className = json['class_name'];
	}
	if (json['student_id'] != null) {
		data.studentId = json['student_id'];
	}
	if (json['username'] != null) {
		data.username = json['username'].toString();
	}
	if (json['status'] != null) {
		data.status = json['status'] is String
				? int.tryParse(json['status'])
				: json['status'].toInt();
	}
	return data;
}

Map<String, dynamic> userProfileResponseDetailToJson(UserProfileResponseDetail entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['uid'] = entity.uid;
	data['real_name'] = entity.realName;
	data['role_int'] = entity.roleInt;
	data['email'] = entity.email;
	data['avatar'] = entity.avatar;
	data['phone'] = entity.phone;
	data['birthday'] = entity.birthday;
	data['sex'] = entity.sex;
	data['location'] = entity.location;
	data['nick_name'] = entity.nickName;
	data['fans'] = entity.fans;
	data['level'] = entity.level;
	data['follows'] = entity.follows;
	data['sign'] = entity.sign;
	data['school'] = entity.school;
	data['major'] = entity.major;
	data['sign_time'] = entity.signTime;
	data['class_name'] = entity.className;
	data['student_id'] = entity.studentId;
	data['username'] = entity.username;
	data['status'] = entity.status;
	return data;
}